import { defineConfig } from '@vben/vite-config';

export default defineConfig(async () => {
  return {
    application: {},
    vite: {
      server: {
        proxy: {
          '/dev-api': {
            changeOrigin: true,
            rewrite: (path) => path.replace(/^\/dev-api/, ''),
            // 实际后端服务地址
            target: 'http://localhost:8080/api',
            ws: true,
          },
        },
      },
      build: {
        minify: 'terser',
        terserOptions: {
          compress: {
            // 移除console输出
            drop_console: true,
            drop_debugger: true,
            pure_funcs: [
              'console.log',
              'console.warn',
              'console.info',
              'console.error',
            ],
          },
        },
      },
    },
  };
});
